//  jQuery Growl
//  Created by Ashit Vora on 2010-06-17.
//

(function($, undefined){
	
	$.growl = {
		
		init : function(){
			//add the basic structure to the body
			$growl = $("<div>");

			//style the growl
			$growl.css({
				"right":0,
				"float" : "right",
				"clear" : "both",
				"width":"300px",
				"zIndex": 999999,
				"fontSize" : "13px",
				"fontFamily": "'Lucida Grande', 'Tahoma', 'verdana', Arial",
				"backgroundColor":"#222",
				"color":"#fff",
				"margin":"10px",
				"padding":"15px",
				"borderRadius":"10px",
				"-webkitBorderRadius":"10px",
				"-mozBorderRadius":"10px",
				"opacity":0.95,
				"filter":"alpha(opacity=95)"
			});
			
		},
		
		
		//show method to display growl.
		//@param Message to be displayed
		show : function(msg) {

			var msg = $.trim(msg);
			
			if( msg.length > 0 ){
				var newGrowl = $growl.clone();
				newGrowl.html( msg ).show().appendTo("body");
				
				//hide after 5 secs
				setTimeout(function(){
					newGrowl.fadeOut(function(){
						newGrowl.remove();
					});
				}, 5000);
				
			}
		}
	};
	
	$("document").ready(function(){
		$.growl.init();
	});
	
	
})(jQuery);